﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoDbObject;

namespace Colligate.DataSource.DriverTraining.Business
{
    class BusinessFinance:BaseLegoModule
    {
        private const string TABLE_PRICE_LAVEL = "BusinessFinancePriceLevel";
        private const string TABLE_RECEIVABLE = "BusinessFinanceReceivable";

        public BusinessFinance(IDataSourceLayer dataLayer)
            : base(new string[] { TABLE_PRICE_LAVEL, TABLE_RECEIVABLE }, dataLayer)
        {
        }

        #region 返回Lego模块涉及到的数据名称的结构信息
        /// <summary>
        /// 返回Lego模块涉及到的数据名称的结构信息
        /// </summary>
        /// <param name="strDataName">基础表名称</param>
        /// <returns>表结构信息</returns>
        override public IFieldInfo[] GetStructInfo(string strDataName)
        {
            // 建立IFieldInfo列表
            // CFieldInfo(字段名, 类型, 长度, 索引, 状态, 字段说明, 字段帮助, 显示的格式化字符串, 字段宽度, 关联记录)
            // 类型： text，byte，short，long，single，double，currency，date，logical，memo，binary
            // 索引： 0 无索引，1 重复索引，2 唯一索引，3 关键字段
            // 状态： 0 系统字段，>1显示信息的字段， 2 用于标识记录名称的字段

            IFieldInfo[] tableStructInfo;
            switch (strDataName)
            {
                case TABLE_RECEIVABLE:
                    tableStructInfo = new IFieldInfo[4];
                    tableStructInfo[0] = new CFieldInfo("fVehicleGuid", "text", 36, 2, 0, "驾校车辆基本信息", "驾校车辆基本信息", "", 52, 0);
                    tableStructInfo[1] = new CFieldInfo("fVehicleLicense", "text", 10, 0, 1, "车牌号", "车牌号", "", 52, 0);
                    tableStructInfo[2] = new CFieldInfo("fVehicleUnit", "text", 20, 0, 1, "车辆型号", "车辆型号", "", 52, 0);
                    tableStructInfo[3] = new CFieldInfo("fVehicleStatus", "text", 10, 0, 1, "车辆状态[可用|报废|停用]", "车辆状态[可用|报废|停用]", "", 52, 0);                    
                 break;

                default: tableStructInfo = null; break;
            }
            return tableStructInfo;
        }
        #endregion
    }
}
